<?php
namespace app\home\model;
/**
 * 基础模型
 */
use think\Model;
use think\Db;
class Base extends Model {
  /**
   * 获取空模型
   */
  public function getEModel($table){
    $rs = Db::query('show columns from `'.config('database.prefix').$table.'`');
    $obj = [];
    if($rs){
      foreach($rs as $v){
        $obj[$v['Field']] = $v['Default'];
        if($v['Key'] == 'PRI')$obj[$v['Field']] = 0;
      }
    }
    return $obj;
  }
}